import { Component } from 'react';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import { Toast, Button,TabBar } from 'saltui';

import Time from 'salt-icon/lib/Time';
import User from 'salt-icon/lib/User';
import Eye from 'salt-icon/lib/Eye';
import Plus from 'salt-icon/lib/Plus';

import './PageHome.less';

export default class Console extends  React.Component  {

  constructor(props,context) {
    super(props,context);

   let activeIndex = parseInt(props.activeIndex);

    this.state = {
      activeIndex: activeIndex,
    };



    this.tabBarItems = [
      //{
      //  title: '工作',
      //  icon: <Time />,
      //  path: 'work',
      //},
      {
        title: '通讯录',
        icon: <Eye />,
        path: 'work',
      },
      {
        title: '工作',
        icon: <User />,
        path: 'work',
      },
    ];
  }

  render() {
    const onChange = (activeIndex) => {
      // 这里是触发每个item之后的回调，会返回当前点击的item的index 值
      console.info(activeIndex);
      if(activeIndex == 0){
        this.props.history.push('work');
      }

      if(activeIndex == 1){
        this.props.history.push('phone');
      }

      if(activeIndex == 2){
        this.props.history.push('my');
      }

    };

    const tabBarStyle = {};

    return (<div>

      <TabBar
        tabBarStyle={tabBarStyle}
        activeIndex={this.state.activeIndex}
        onChange={onChange}
        iconHeight={24}
        cIconHeight={50}
        tabBarPosition="bottom"
        items={this.tabBarItems}
      />



    </div>);
  }
}

